/**
 * This class represents an entry in a routing table to support class
 * RoutingTable.java.
 * 
 * @author Jonathan Jung, Timothy Hong, Ronen Adam
 * 
 */
public class RoutingTableEntry {

    private String netID;
    private int subnetMask;
    private String gateway;

    public RoutingTableEntry(String netID, int subnetMask, String gateway) {
        this.netID = netID;
        this.subnetMask = subnetMask;
        this.gateway = gateway;
    }

    /**
     * Returns a string representing the IP address of a network ID.
     * 
     * @return Returns a string representing the IP address of a network ID.
     */
    public String getNetID() {

        return netID;
    }

    /**
     * Returns the subnet mask value of an entry.
     * 
     * @return Returns the subnet mask value of an entry.
     */
    public int getSubnetMask() {

        return subnetMask;
    }

    /**
     * Returns a string representing the IP address of a gateway.
     * 
     * @return Returns a string representing the IP address of a gateway.
     */
    public String getGateway() {

        return gateway;
    }

    /**
     * Returns a string representing a routing table entry.
     * 
     * @return Returns a string representing a routing table entry.
     */
    public String toString() {
        StringBuilder result = new StringBuilder();

        result.append(String.format("%-16s    /%-11s    %-16s", netID,
                subnetMask, gateway));

        result.trimToSize();

        return result.substring(0);
    }

}
